var app = getApp();
var Logger = app.modules['Logger'];

module.exports = {
    set: function (key, data){
        try{
            wx.setStorageSync(key, data);
        }catch(e){
            Logger.error(e);
            return false; 
        }
        return true;
    },
    get: function(key,default_value){
        try{
            var v = wx.getStorageSync(key);
            if(v == null || v == ''){
                if(default_value != undefined){
                    return default_value;
                }
            }
            return v;
        }catch(e){
            Logger.error(e);
            return null;
        }
    },
    remove:function(key){
        try {
            wx.removeStorageSync(key);
        } catch (e) {
            Logger.error(e);
            return false;
        }
        return true;
    }
}